<%@page import="com.wef.demo.entity.domain.StudentSubjectDomain"%>
<%@page import="com.wef.demo.entity.domain.StudentDomain"%>
<%@page import="com.wef.demo.entity.domain.ClazzDomain"%>
<%@page import="com.wef.demo.entity.domain.SubjectDomain"%>
<%@page import="com.gfa4j.resource.ResourceManagerServer"%>
<%@page import="com.wef.common.util.CommonMessageDomain"%>
<%@page import="com.gfa4j.query.Field"%>
<%@ include file="/pages/common/taglib.jsp"%>
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
		<title></title>
		<%@include file="/styles/css_lib.jsp"%>
		<%@include file="/scripts/widgets/jquery-ui/css_lib.jsp"%>
		<%@include file="/scripts/widgets/jqgrid/css_lib.jsp"%>
		<%@include file="/scripts/widgets/autoSelect/css_lib.jsp"%>
		
		<%@include file="/pages/common/js_global.jsp"%>
		<%@include file="/scripts/sdk/js_lib.jsp"%>
		<%@include file="/scripts/config/js_lib.jsp" %>
		<%@include file="/scripts/utils/js_lib.jsp"%>
		<%@include file="/scripts/i18n/js_lib.jsp"%>
		<%@include file="/scripts/format/js_lib.jsp"%>
		<%@include file="/scripts/validate/js_lib.jsp"%>
		<%@include file="/scripts/widgets/jquery-ui/js_lib.jsp"%>
		<%@include file="/scripts/widgets/jqgrid/js_lib.jsp"%>
		<%@include file="/scripts/widgets/autoSelect/js_lib.jsp"%>
		<%@include file="/scripts/widgets/datePicker/js_lib.jsp"%>
		<%@include file="/scripts/widgets/page-custom/js_lib.jsp"%>
		<script type="text/javascript" src="./demo_class_edit_3.js"></script>
		<k:customSaveConfig
			callback="function(result){alert('OK');}"
			editFormName="editFormClazz"
			saveBtnId="saveBtnClazz"
			objectName="<%=ClazzDomain.Clazz%>"
			serviceMethodName="saveOrUpdateClazz"
			serviceName="ClazzService"
			subGridMaps="[{gridId:'tableStudent',propName:'students'}]"
		/>
		
		<k:jqgrid 
			queryObjectName="<%=StudentDomain.Student%>"
		 	jsonReader="{id:'studentId'}"
		 	colModel="[{name:'studentId',hidden:true},
		 		{actionType:'delete',name:'delete'},
		 		{label:'demo.Student.studentNum',name:'studentNum',editable:true,editrules:{required:true,number:true,minValue:1,maxValue:10000}},
		 		{label:'demo.Student.studentName',name:'studentName',editable:true,editrules:{required:true}},
		 		{label:'demo.Student.birthday',name:'birthday',formatter:'date',formatoptions:{srcformat:'Y-m-d H:i:s',newformat:'Y-m-d'},originalDataType:'date',editable:true,editrules:{date:true}},
		 		{label:'demo.Student.address',name:'address',edittype:'text',editable:true,editrules:{required:true}},
		 		{label:'demo.Student.telphone',name:'telphone'},
		 		{label:'demo.Student.phone',name:'phone'},
		 		{label:'demo.Student.gender',name:'gender',formatterValueText:'genderArr',editable:true,edittype:'select',editoptions:'genderObj'},
		 		{label:'demo.Student.email',name:'email',editable:true,editrules:{required:true,email:true}},
		 		{label:'demo.Student.idCard',name:'idCard'},
		 		{label:'demo.Student.remark',name:'remark',editable:true,edittype:'textarea',editoptions:{rows:3,cols:10},editrules:{custom:true,custom_func:'custom_func4StudentRemark'}}
		 		]"		 		
			id="tableStudent"
		 	newBtnId="newBtnStudent"
		 	cancelBtnId="cancelBtnStudent"
		 	deleteBtnId="deleteBtnStudent"
		 	serviceMethodName="saveOrUpdateStudents"
		 	serviceName="StudentService"
		 	setQueryInfo="setQueryInfo4Student"
		 	enabledLoad="false"
		 	subGridMaps="[{gridId:'tableStudentSubject',propName:'studentSubjects'}]"
		 	afterSelectRow="afterSelectRow4Student"
		 	autowidth="false"
		 	cellEdit="true"
		 	afterEditCellFunc="afterEditCellFunc4Student"
		 	/>
		 	
		<k:autoSelectConfig 
			className="com.wef.demo.entity.Student" 
			url="${ctx}" 
			id="colAddress" 
			width="600" 
			displayField="studentNum,studentName,address,telphone,phone" 
			canNotInput="true"
			afterSelectRow="afterSelectRow4Student2"
			displayNum="8"
			displayFieldI18n="demo.Student.studentNum,demo.Student.studentName,demo.Student.birthday,demo.Student.address,demo.Student.telphone,demo.Student.phone" 
			queryField="studentNum,studentName,address,telphone,phone"
			onlyConfig="true"
			/>
		 	
		<k:jqgrid 
			queryObjectName="<%=StudentSubjectDomain.StudentSubject%>"
		 	jsonReader="{id:'studentSubjectId'}"
		 	colModel="[{name:'studentSubjectId',hidden:true},
		 		{label:'demo.StudentSubject.subjectCode',name:'subjectCode',editable:true,editrules:{required:true,number:true,minValue:1,maxValue:10000}},
		 		{label:'demo.StudentSubject.subjectName',name:'subjectName'}
		 		]"
			id="tableStudentSubject"
		 	newBtnId="newBtnStudentSubject"
		 	cancelBtnId="cancelBtnStudentSubject"
		 	deleteBtnId="deleteBtnStudentSubject"
		 	serviceMethodName="saveOrUpdateStudentSubjects"
		 	serviceName="StudentSubjectService"
		 	setQueryInfo="setQueryInfo4StudentSubject"
		 	enabledLoad="false"
		 	cellEdit="true"
		 	afterEditCellFunc="afterEditCellFunc4StudentSubject"
		 	/>
		 	
		<k:autoSelectConfig 
			url="${ctx}" 
			id="colSubjectCode" 
			width="350" 
			displayField="subjectName,subjectCode" 
			className="com.wef.demo.entity.Subject" 
			displayFieldI18n="demo.Subject.subjectName,demo.Subject.subjectCode" 
			displayNum="8"
			onlyConfig="true"
			afterSelectRow="afterSelectRow4Subject"
			/>
		
		<script type="text/javascript">
			//App.pageCustomEnable = true;App.pageId = "jqgrid";
			$(window).ready(function(){
				$('div[accordion=true]').accordion({collapsible : true});
				$('div[tabGroup=true]').tabs();
				$('#pageLoadComplete').attr('isComplete',true);
			});
		</script>
	</head>
<body class="body">
	<div id="divAccordion1" accordion="true">
		<h1><a href="#"><%=ResourceManagerServer.getInstance().getMessage(ClazzDomain.ClazzNLS)%>&nbsp;<%=ResourceManagerServer.getInstance().getMessage(CommonMessageDomain.TITLE_EDIT)%></a></h1>
		<div>
			<form id="editFormClazz" name="editFormClazz">
				<ul id="editUlClazz" allowChange="true" class="edit_box">
					<k:hidden property="clazzId" styleId="editClazzId" value='<%=request.getParameter("clazzId")%>'/>
					<li>
						<k:label text="demo.Clazz.clazzName"/>
						<k:text property="clazzName" styleClass="text" styleId="editClazzName" validateRules="{required:true}"/>
					</li>
					<li>
						<k:label text="demo.Clazz.count"/>
						<k:text property="count" styleClass="text" styleId="editCount" validateRules="{number:true}"/>
					</li>
					<li>
						<k:label text="demo.Clazz.clazzNum"/>
						<k:text property="clazzNum" styleClass="text" styleId="editClazzNum" validateRules="{required:true}"/>
					</li>
				</ul>
			</form>
		</div>
	</div>
	
	<div class="ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content-active">
		<ul class="button_box">
			<li>
				<k:button styleId="saveBtnClazz" styleClass="button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" text="<%=CommonMessageDomain.BUTTON_SAVE%>"/>
			</li>
		</ul>
	</div>
	
	<div id="tabs" tabGroup="true">
		<ul>
			<li><a id="aTabItem1" href="#tabItem1"><%=ResourceManagerServer.getInstance().getMessage(ClazzDomain.ClazzNLS)%>&nbsp;<%=ResourceManagerServer.getInstance().getMessage(CommonMessageDomain.TITLE_EDIT)%></a></li>
			<li><a id="aTabItem2" href="#tabItem2"><%=ResourceManagerServer.getInstance().getMessage(StudentDomain.StudentNLS)%>&nbsp;<%=ResourceManagerServer.getInstance().getMessage(CommonMessageDomain.TITLE_EDIT)%></a></li>
			<li><a id="aTabItem3" href="#tabItem3"><%=ResourceManagerServer.getInstance().getMessage(StudentSubjectDomain.StudentSubjectNLS)%>&nbsp;<%=ResourceManagerServer.getInstance().getMessage(CommonMessageDomain.TITLE_EDIT)%></a></li>
		</ul>
		
		<div id="tabItem1">
			<div id="divAccordion2" accordion="true">
				<h1><a href="#"><%=ResourceManagerServer.getInstance().getMessage(ClazzDomain.ClazzNLS)%>&nbsp;<%=ResourceManagerServer.getInstance().getMessage(CommonMessageDomain.TITLE_EDIT)%></a></h1>
				<div>
					<form id="editFormClazz2" name="editFormClazz">
						<ul id="editUlClazz" allowChange="true" class="edit_box">
							<li>
								<k:label text="demo.Clazz.lesder"/>
								<k:text property="lesder" styleClass="text" styleId="editLesder"/>
							</li>
							<li>
								<k:label text="demo.Clazz.fee"/>
								<k:text property="fee" styleClass="text" styleId="editFee"/>
							</li>
						</ul>
					</form>
				</div>
			</div>	
		</div>
		
		<div id="tabItem2">
			<div class="ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content-active">
				<ul class="button_box">
					<li>
						<k:button styleId="newBtnStudent" styleClass="button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" text="<%=CommonMessageDomain.BUTTON_NEW%>"/>
					</li>
					<li>
						<k:button styleId="cancelBtnStudent" styleClass="button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" text="<%=CommonMessageDomain.BUTTON_CANCEL%>"/>
					</li>
					<li>
						<k:button styleId="deleteBtnStudent" styleClass="button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" text="<%=CommonMessageDomain.BUTTON_DELETE%>"/>
					</li>
				</ul>
			</div>
			
			<div id="divAccordion3" accordion="true">
				<h1><a href="#"><%=ResourceManagerServer.getInstance().getMessage(StudentDomain.StudentNLS)%>&nbsp;<%=ResourceManagerServer.getInstance().getMessage(CommonMessageDomain.TITLE_TABLE)%></a></h1>
				<div>
					<table id="tableStudent"></table>
				</div>
			</div>
			
		</div>
		
		<div id="tabItem3">
			<div class="ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content-active">
				<ul class="button_box">
					<li>
						<k:button styleId="newBtnStudentSubject" styleClass="button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" text="<%=CommonMessageDomain.BUTTON_NEW%>"/>
					</li>
					<li>
						<k:button styleId="cancelBtnStudentSubject" styleClass="button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" text="<%=CommonMessageDomain.BUTTON_CANCEL%>"/>
					</li>
					<li>
						<k:button styleId="deleteBtnStudentSubject" styleClass="button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" text="<%=CommonMessageDomain.BUTTON_DELETE%>"/>
					</li>
				</ul>
			</div>
			
			<div id="divAccordion5" accordion="true">
				<h1><a href="#"><%=ResourceManagerServer.getInstance().getMessage(StudentSubjectDomain.StudentSubjectNLS)%>&nbsp;<%=ResourceManagerServer.getInstance().getMessage(CommonMessageDomain.TITLE_TABLE)%></a></h1>
				<div>
					<table id="tableStudentSubject"></table>
				</div>
			</div>
					
		</div>
		
	</div>
	<div id="pageLoadComplete" isComplete="false" style="display: none;"></div>
</body>
</html>